package com.jingjin.humanityservice.util.ranking.autoRanking;

import com.jingjin.humanityservice.util.ranking.*;
import jakarta.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * ClassName: autoRanking
 * Description:
 *
 */
@Component
public class autoRanking {
    @Resource
    private BilibiliRankingHandler bilibiliRankingHandler;

    @Resource
    private BaiduRankingHandler baiduRankingHandler;

    @Resource
    private CSDNRankingHandler csdnRankingHandler;

    @Resource
    private DouyinRankingHandler douyinRankingHandler;

    @Resource
    private ITHomeRankingHandler itHomeRankingHandler;

    @Resource
    private KrRankingHandler krRankingHandler;

    @Resource
    private WeiboRankingHandler weiboRankingHandler;

    @Resource
    private ZhihuRankingHandler zhihuRankingHandler;

    @Resource
    private JuejinRankingHandler juejinRankingHandler;


//    @Scheduled(fixedRate = 10000) // 每10秒执行一次
    @Scheduled(fixedRate = 180000) // 每3分钟执行一次
    public void runITHomeRankingTask() {
        try {
            // 百度
            baiduRankingHandler.getBaiduRanking();

            // 哔哩哔哩
            bilibiliRankingHandler.getBilibiliRanking();

            // CSDN
            csdnRankingHandler.getCSDNRanking();

            // 抖音
            douyinRankingHandler.getDouyinRanking();

            // IT之家
//            itHomeRankingHandler.getITHomeRanking();

            // 稀土掘金
            juejinRankingHandler.getJuejinRanking();

            // 36氪
            krRankingHandler.getKrRanking();

            // 微博
            weiboRankingHandler.getWeiboRanking();

            // 知乎
            zhihuRankingHandler.getZhihuRanking();

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
